package com.zmn.plat.admin.controller.contract.payment.record;

import java.math.BigDecimal;
import java.util.Objects;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.zmn.common.utils.math.MathUtil;
import com.zmn.plat.admin.controller.PlatBaseController;
import com.zmn.plat.manager.dictionary.MasterDict;
import com.zmn.plat.services.interfaces.contract.payment.record.ContractPaymentRecordService;

/**
 * 合同收付记录表
 *
 * @author linfeng
 *
 * @since 2020-05-09 11:41:45
 */
public class ContractPaymentRecordBaseController extends PlatBaseController {
    protected Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    protected ContractPaymentRecordService contractPaymentRecordService;

    protected String narrow(Object dividend) {
        if (Objects.isNull(dividend)) {
            return "";
        }
        double div = MathUtil.div(dividend.toString(), String.valueOf(MasterDict.COEFFICIENT_MAGNIFICATION), 2);
        BigDecimal b = new BigDecimal(div);
        return b.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
    }
}
